<template>
  <div class="drawcash-box scrllor">
    <mu-row gutter class="list-box">
      <mu-col span="12">
        <mu-paper>
          <mu-load-more
            @refresh="refresh"
            :refreshing="refreshing"
            :loaded-all="loaded_all"
            :loading="loading"
            @load="load"
          >
            <mu-list>
              <mu-list-item to="/admin/drawcash" v-for="(item,index) in drawcashList" :key="index">
                <mu-list-item-action>
                  <div class="icon-box">
                    <span class="iconfont icon-weixin"></span>
                  </div>
                </mu-list-item-action>
                <mu-list-item-content>
                  <mu-list-item-title>
                    <div class="fleft">{{item.mobile}}</div>
                    <div class="fright">¥{{item.amount}}</div>
                    <div class="_clear"></div>
                  </mu-list-item-title>
                  <mu-list-item-sub-title>
                    <div class="fleft">{{item.createTime}}</div>
                    <div class="fright">{{item.status}}</div>
                    <div class="_clear"></div>
                  </mu-list-item-sub-title>
                </mu-list-item-content>
              </mu-list-item>
              <mu-divider></mu-divider>
            </mu-list>
          </mu-load-more>
        </mu-paper>
      </mu-col>
    </mu-row>
     <div v-show="nolist" class="nolist">
        <span class="iconfont icon-charging"></span>
        <p>暂无提现记录</p>
      </div>
  </div>
</template>

<script>
import { Toast } from "vant";
import "vant/lib/toast/style/index";
export default {
  data() {
    return {
      num: 10,
      nolist: true,
      loaded_all: false,
      refreshing: false,
      loading: false,
      drawcashList: []
    };
  },
  mounted() {
    this.getList({ pageNo: 1, pageSize: this.num });
  },
  methods: {
    getList(params) {
      this.$api.getCashRecord(params).then(res => {
        console.log(res)
        if (res.data != "") {
          console.log(res);
          if (res.data.message.code == 0) {
            this.drawcashList = res.data.data.records;
            console.log(this.drawcashList);
            this.nolist = false;
            if (res.data.data.pages == 1) {
              Toast("已加载全部数据");
              this.loaded_all = true;
            }
            if(res.data.data.pages == 0){
                Toast("暂无提现记录");
            }
          }
        } else {
          this.drawcashList = [];
          Toast("暂无提现记录");
        }
      });
    },

    refresh() {
      this.refreshing = true;
      this.$refs.container.scrollTop = 0;
      setTimeout(() => {
        this.refreshing = false;
        this.getList({ pageNo: 1, pageSize: 5 });
      }, 2000);
    },
    load() {
      this.loading = true;
      setTimeout(() => {
        this.loading = false;
        this.num += 3;
        this.getList({ pageNo: 1, pageSize: this.num });
      }, 2000);
    }
  }
};
</script>

<style>
</style>
